﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PingPongMain
{
    class TomCatPingPongMain
    {

        static void Main(string[] args)
        {

            Ball theBall = new Ball(new Coords(1, 2), Ball.Direction.UpLeft);
            Console.SetCursorPosition(theBall.GameObjCoords.Col, theBall.GameObjCoords.Row);
            Console.WriteLine(theBall.GameObjSymbol);
            Paddle firstPlayerPaddle = new Paddle(new Coords(6, 0));
            firstPlayerPaddle.Width = 2;
            firstPlayerPaddle.Length = 6;
            IEventHandler keybord = new Keybord();
            keybord.OnUpArrowPressed += (sender, eventInfo) =>
            {
                PlayerMovement.MovePaddleUp(firstPlayerPaddle);
            };
            keybord.OnDownArrowPressed += (sender, eventInfo) =>
            {
                PlayerMovement.MovePaddleDown(firstPlayerPaddle);
            };
            while (true)
            {
                
                Console.Clear();
                PrepareField.SetGameField();
                for (int i = 0; i < firstPlayerPaddle.Length; i++)
                {
                    Console.SetCursorPosition(firstPlayerPaddle.GameObjCoords.Col, firstPlayerPaddle.GameObjCoords.Row + i);
                    Console.WriteLine(firstPlayerPaddle.GameObjSymbol);
                    Console.SetCursorPosition(firstPlayerPaddle.GameObjCoords.Col + 1, firstPlayerPaddle.GameObjCoords.Row + i);
                    Console.WriteLine(firstPlayerPaddle.GameObjSymbol);
                }
                System.Threading.Thread.Sleep(100);
            }
        }
    }
}
